<%@ page import="com.lagou.task.service.ClassService" %>
<%@ page import="com.lagou.task.entity.SysClass" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    ClassService service = new ClassService();
    List<SysClass> sysClasses = service.showAllService();
%>

<!--增加用户模态框-->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">添加信息</h4>
            </div>
            <div class="modal-body">
                <!--定义表单-->
                <form class="form-horizontal" role="form" id="addForm" action="add" method="post">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">学号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入8位学号" name="id">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入姓名" name="name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">性别</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="sex">
                                <option>男</option>
                                <option>女</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">出生日期</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="格式：2020-01-01" name="birth">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">邮箱</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入邮箱" name="email">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">班级</label>
                        <c:set var="classes" value="<%=sysClasses%>" />
                        <c:choose>
                            <c:when test="${classes != null}">
                                <div class="col-sm-10">
                                    <select class="form-control" name="className">
                                        <c:forEach var="c" items="${classes}">
                                            <option>${c.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </c:when>
                            <c:when test="${classes == null}">
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" value="暂无班级" name="className" disabled>
                                </div>
                            </c:when>
                        </c:choose>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="请输入备注" name="note">
                        </div>
                    </div>
                    <!--定义按钮-->
                    <div class="modal-footer form-group">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="submit" class="btn btn-primary" id="add">新增</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>